﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing.Printing;
using System.IO;
using System.Text;
using System.Data;
using System.Web.UI;



namespace WebApplication1
{
    public partial class frmViewDisbursementDetailList : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string rid = Request.QueryString["ReqID"];
                BusinessController.OutstandingRequisitionManager manager = new BusinessController.OutstandingRequisitionManager(rid);
                dgEmpOutstandingDetail.DataSource = BusinessController.OutstandingRequisitionManager.getAllDistributionDetailRequisition();
                dgEmpOutstandingDetail.DataBind();
            }
        }

        protected void Print_Click(object sender, EventArgs e)
        {
            //btnPrint.Attributes.Add("Onclick", "getPrint('print_area');");
            //btnTablePP.Attributes.Add("Onclick", "getPrint('Print_Table');");
            //btnPagepp.Attributes.Add("Onclick", "getPrint('Print_All');");


            //dgEmpOutstandingDetail.UseAccessibleHeader = true;
            //dgEmpOutstandingDetail.HeaderRow.TableSection = TableRowSection.TableHeader;
            //dgEmpOutstandingDetail.FooterRow.TableSection = TableRowSection.TableFooter;
            //dgEmpOutstandingDetail.Attributes["style"] = "border-collapse:separate";
            //foreach (GridViewRow row in dgEmpOutstandingDetail.Rows)
            //{
            //    if (row.RowIndex % 10 == 0 && row.RowIndex != 0)
            //    {
            //        row.Attributes["style"] = "page-break-after:always;";
            //    }
            //}
            //StringWriter sw = new StringWriter();
            //HtmlTextWriter hw = new HtmlTextWriter(sw);
            //dgEmpOutstandingDetail.RenderControl(hw);
            //string gridHTML = sw.ToString().Replace("\"", "'").Replace(System.Environment.NewLine, "");
            //StringBuilder sb = new StringBuilder();
            //sb.Append("<script type = 'text/javascript'>");
            //sb.Append("window.onload = new function(){");
            //sb.Append("var printWin = window.open('', '', 'left=0");
            //sb.Append(",top=0,width=1000,height=600,status=0');");
            //sb.Append("printWin.document.write(\"");
            //string style = "<style type = 'text/css'>thead {display:table-header-group;} tfoot{display:table-footer-group;}</style>";
            //sb.Append(style + gridHTML);
            //sb.Append("\");");
            //sb.Append("printWin.document.close();");
            //sb.Append("printWin.focus();");
            //sb.Append("printWin.print();");
            //sb.Append("printWin.close();");
            //sb.Append("};");
            //sb.Append("</script>");
            //ClientScript.RegisterStartupScript(this.GetType(), "GridPrint", sb.ToString());
            //dgEmpOutstandingDetail.DataBind();

        }
}
}
